<!doctype html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1.0">
<title>phosphorus</title>
<link rel=stylesheet href=../css/player.css>
<link rel=stylesheet href=../css/embed.css>
<div class=controls>
  <div class=progress-bar></div>
  <span class=stop></span>
  <span class=pause></span>
  <span class=flag title="Shift+click to enable turbo mode."></span>
  <div class=turbo>Turbo Mode</div>
  <span class=full-screen></span>
</div>
<div class=player></div>
<div class=internal-error>
  An internal error occurred. <a id=error-bug-link target=_blank href=https://github.com/nathan/phosphorus/issues/new>Click here</a> to file a bug report.
</div>
<div class=webgl-error>
  It looks like your device doesn't support WebGL. You can try viewing this project in the legacy player <a id=legacy-link target=_blank href=https://sulfurous.aau.at/legacy>here</a>.
</div>
<script src=../js/fonts.js></script>
<script src=//cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.js></script>
<script src=../js/gl-matrix-min.js></script>
<script src=../js/phosphorus.js></script>
<script src=../js/player.js></script>
<script src=../js/shaders.js></script>
<script src=../fonts/fonts.js></script>
<script>

(function() {
  'use strict';

  var projectId = 17088932;
  var autoStart = false;
  var lightContent = false;
  var hasUI = true;
  var resolutionX = 480;
  var resolutionY = 360;

  var params = location.search.substr(1).split('&');
  params.forEach(function(p) {
    var parts = p.split('=');
    if (parts.length > 1) {
      switch (parts[0]) {
        case 'id':
          projectId = Number(parts[1]);
          break;
        case 'auto-start':
          autoStart = parts[1] !== 'false';
          break;
        case 'light-content':
          lightContent = parts[1] !== 'false';
          break;
        case 'ui':
          hasUI = parts[1] !== 'false';
          break;
        case 'resolution-x':
          resolutionX = Number(parts[1]);
          break;
		case 'resolution-y':
		  resolutionY = Number(parts[1]);
		  break;
        default:
          console.log('Skipping unknown option: ' + parts[0] + '=' + parts[1])
      }
    }
  });
  
  P.resolution = resolutionX;

  P.player.setResolution(resolutionX, resolutionY);
  document.body.style.width = resolutionX + 'px';
  
  if (lightContent) document.body.className += ' light-content';
  document.body.className += hasUI ? ' has-ui' : ' hide-ui';

  document.title = 'phosphorus';
  P.player.load(projectId, function(stage) {
    if (autoStart || !hasUI) stage.triggerGreenFlag();
  }, function(title) {
    document.title = title ? title + ' \xb7 phosphorus' : 'phosphorus';
  });

}());

</script>